//
//  SortTableViewCell.m
//  Car
//
//  Created by apple on 15/9/17.
//  Copyright (c) 2015年 朱鸿儒. All rights reserved.
//

#import "SortTableViewCell.h"

@implementation SortTableViewCell

- (void)awakeFromNib {

}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

}


- (void)setValueWithModel:(RecommendModel *)model {
    
    if ([Setting shareWithSetting].isOnPic == NO) {
    [self.showImageView sd_setImageWithURL:[NSURL URLWithString:model.smallpic]];
    }
    
    self.introduceLabel.text = model.title;
    self.timeLabel.text = model.time;
    self.replayLabel.text = [NSString stringWithFormat:@"评论:%@", model.replycount];

}










//  初始化
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        self.frame = CGRectMake(0, 0, 375, 80);
        
        self.showImageView = [[UIImageView alloc] initWithFrame:CGRectMake(15, 10, self.frame.size.height, self.frame.size.height - 10 * 2)];
        [self setUpRecommendpic:self.showImageView];
        
      //  NSLog(@"%f", self.frame.size.width);
      //  NSLog(@"%f", self.frame.size.height);
        
        self.timeLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.showImageView.frame.size.width + 10 + 10, self.frame.size.height - 20, 100, 15)];
        self.timeLabel.font = [UIFont fontWithName:@"AppleGothic" size:10];
        
        self.introduceLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.showImageView.frame.size.width + 10 + 10, 3, self.frame.size.width - self.showImageView.frame.size.width - 20, 40)];
        self.introduceLabel.font = [UIFont fontWithName:@"Arial-BoldItalicMT" size:16];

        
        self.replayLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.frame.size.width - 50 - 20, self.frame.size.height - 20, 70, 20)];
        self.replayLabel.font = [UIFont fontWithName:@"American Typewriter" size:12];

        
        [self setUpRecommendLabel:self.introduceLabel];
        [self setUpRecommendLabel:self.replayLabel];
        [self setUpRecommendLabel:self.timeLabel];

    }
    
    
    
    
    return self;
    
}



#pragma mark ---  封装属性   ---


//  图片
- (void)setUpRecommendpic:(UIImageView *)pic {
    
   // pic.frame = CGRectMake(10, 10, 30, 30);
  //  pic.backgroundColor = [UIColor cyanColor];
    
    
    [self.contentView addSubview:pic];
    
    
}


//  label
- (void)setUpRecommendLabel:(UILabel *)label {
    
  //  label.backgroundColor = [UIColor cyanColor];
    label.numberOfLines = 0;
    
    [self.contentView addSubview:label];
}





























@end
